package com.py.framework.core.rest.support;

import java.io.IOException;

import org.springframework.http.HttpOutputMessage;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

public class ExtMappingJackson2HttpMessageConverter extends MappingJackson2HttpMessageConverter{
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	protected void writeInternal(Object object, HttpOutputMessage outputMessage)
			throws IOException, HttpMessageNotWritableException {
		if(object != null && object.toString().contains("springfox.documentation")){// swagger
			super.writeInternal(object, outputMessage);
			return;
		}
		super.writeInternal(new RestServiceResult(object), outputMessage);
	}
}
